package com.kuang.lesson02.tcp

import java.net.ServerSocket

/**
 * 服务端
 */
fun main() {
    // 声明一个端口
    ServerSocket(9999).use {
        while (true) {
            it.accept().use { socket ->
                socket.getInputStream().use { ips ->
                    val request = String(ips.readBytes())
                    println(request)
                }
            }
        }
    }
}